﻿import QtQuick 2.0
import QtQuick.Controls 2.12

Rectangle{
    width: 100
    height: 40
    color: 'black'
    opacity: 0.8
    visible: false
    radius: 5


    Text{
        id:toastText
        color: 'white'
        width: parent.width
        height: parent.height

        font{
            pixelSize: 18
            bold: true
        }
        text: '提示'
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter

    }

    Timer {
        id:helloTimer;
        interval: 1000; //定时周期
        repeat:false;    //
        triggeredOnStart: false;
        onTriggered: {
            toast.visible = false
        }
    }


    function showToast(msg){
        toastText.text = msg
        toast.visible = true
        helloTimer.start()
    }
}

